<?php
namespace Home\Controller;

use Think\Controller;

class AssetDetailController extends Controller
{
    public function index() {
        $asset_lendId = $_GET['id'];
        $assetD_ids = M('asset_lend')->field('asset_ids')->where('id=' . $asset_lendId)->find();

        $ids['id'] = array('in', $assetD_ids['asset_ids']);

//        分页
        $field = 'name,asset_num,use_time,save_person';
        $result = M('asset')->field($field)->where($ids)->select();;
        $count = count($result);
        $Page = new \Think\Page($count, 5);
        $Page->setConfig('next', '上一页');
        $Page->setConfig('prev', '下一页');
        $show = $Page->show();//

        $asset_detail = M('asset')->field($field)->where($ids)->limit($Page->firstRow . ',' . $Page->listRows)->select();
        $this->assign('count', $count);
        $this->assign('show', $show);


//      根据$assetD_ids的的值进行分割获取各个资产的基本进行进行输出 ，并与user进行联表查询保管人名称（或者直接输入保管人名称和电话号码？）
        $this->assign('asset_detail', $asset_detail);
        $this->display('teacher/assetDetail');
    }
}